package com.sq.partner.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sq.partner.manager.dao.IGatewayAgencyChannelDao;
import com.sq.partner.manager.dao.IGatewayAgencyDao;
import com.sq.partner.manager.dao.IGatewayChannelInfoConfigDao;
import com.sq.partner.manager.mybatis.model.GatewayAgency;
import com.sq.partner.manager.mybatis.model.GatewayAgencyChannel;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.mybatis.model.TreeDto;
import com.sq.partner.manager.service.IGatewayAgencyInfoConfigService;
import com.sq.partner.manager.util.Page;

@Service
public class IGatewayAgencyInfoConfigServiceImpl implements IGatewayAgencyInfoConfigService {
	@Resource
	private IGatewayAgencyDao agencyDao;
	@Resource
	private IGatewayAgencyChannelDao agencyChannelDao;
	@Resource
	private IGatewayChannelInfoConfigDao channelInfoConfigDao;

	@Override
	public Page<GatewayAgency> queryInfoByCriteria(Page<GatewayAgency> page,GatewayUser user) throws Exception {
		
		return agencyDao.queryInfoByCriteria(page, user);
	}

	@Override
	public boolean addAgencyInfo(GatewayAgency agency) throws Exception {
		return agencyDao.addAgencyInfo(agency);
	}

	@Override
	public boolean updateAgencyInfo(GatewayAgency agency) throws Exception {
		return agencyDao.updateAgencyInfo(agency);
	}

	@Override
	public GatewayAgency queryAgencyInfoByCode(GatewayAgency agency) throws Exception {
		return agencyDao.queryAgencyInfoByCode(agency);
	}

	@Override
	public boolean deleteAgencyInfo(GatewayAgency agency) throws Exception {
		return agencyDao.deleteAgencyInfo(agency);
	}

	@Override
	public int checkIsExistFacadeUser(String agencyCode) throws Exception {
 		return agencyDao.checkIsExistFacadeUser(agencyCode);
	}

	@Override
	public boolean addPrivilegesToOneAgency(GatewayAgencyChannel gac) throws Exception {
		return agencyChannelDao.addPrivilegesToOneAgency(gac);
	}

	@Override
	public boolean delPrivilegesByAgencyCode(GatewayAgencyChannel gac) throws Exception {
		return agencyChannelDao.delPrivilegesByAgencyCode(gac);
	}

	@Override
	public List<GatewayAgencyChannel> queryPrivilegesByAgencyCode(GatewayAgencyChannel gac) throws Exception {
		return agencyChannelDao.queryPrivilegesByAgencyCode(gac);
	}

	@Override
	public List<TreeDto> queryChannelInfoListsForTree(String deptCode) throws Exception {
		return channelInfoConfigDao.queryChannelInfoListsForTree(deptCode);
	}
}
